package com.mc.read.adminapi.manager;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mc.read.common.constant.Constants;
import com.mc.read.common.emun.ServiceCodeEnum;
import com.mc.read.common.exception.ServiceException;
import com.mc.read.common.util.TreeUtils;
import com.mc.read.dao.mapper.*;
import com.mc.read.dao.models.*;
import com.mc.read.dao.models.sys.Sysuser;
import com.mc.read.dao.vo.BookPageVo;
import com.mc.read.dao.vo.BookTypeNode;
import com.mc.read.dao.vo.PageResposeVo;
import com.mc.read.vo.request.BaseRequest;
import com.mc.read.vo.respose.BaseRespose;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;

import java.util.Date;
import java.util.List;

/**
 * @author liuhao
 * @date 2019/6/14 10:10
 */
@Component
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
public class BooksManager {
    @Autowired
    BooktypeMapper booktypeMapper;
    @Autowired
    CacheManager cacheManager;
    @Autowired
    BookinformationMapper bookinformationMapper;
    @Autowired
    BooklabelMapper booklabelMapper;
    @Autowired
    LabelMapper labelMapper;
    @Autowired
    BookauditMapper bookauditMapper;

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 选择书籍类型 selectBookType
     **/
    public BaseRespose selectBookType(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();
//        Booktype booktype = null;
//        try {
//            booktype = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Booktype.class);
//        } catch (Exception e) {
//            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL, JSON.toJSONString(baseRequest));
//        }
//        if (ObjectUtils.isEmpty(booktype.getParentid())) {
//            throw new ServiceException(203020, "请选择父类型", JSON.toJSONString(baseRequest));
//        }
//        BooktypeExample example = new BooktypeExample();
//        example.createCriteria().andParentidEqualTo(booktype.getParentid());
//        example.setOrderByClause("sort");
//        baseRespose.setReturnString(booktypeMapper.selectByExample(example));

        List<BookTypeNode> bookTypeNodeList = booktypeMapper.selectBookType();
        bookTypeNodeList = TreeUtils.listGetStreeForBookType(bookTypeNodeList);
        baseRespose.setReturnString(bookTypeNodeList);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 添加书籍类型 addBookType
     **/
    public BaseRespose addBookType(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();

        Booktype booktype = null;
        try {
            booktype = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Booktype.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL, JSON.toJSONString(baseRequest));
        }
        if (ObjectUtils.isEmpty(booktype.getParentid())) {
            throw new ServiceException(203020, "请选择父类型", JSON.toJSONString(baseRequest));
        }
        if (ObjectUtils.isEmpty(booktype.getBooktypename())) {
            throw new ServiceException(203020, "类型名称不能为空", JSON.toJSONString(baseRequest));
        }
        BooktypeExample example = new BooktypeExample();
        example.createCriteria().andParentidEqualTo(booktype.getParentid()).andBooktypenameEqualTo(booktype.getBooktypename());
        List<Booktype> booktypeList = booktypeMapper.selectByExample(example);
        if (booktypeList.size() > 0) {
            throw new ServiceException(203020, "类型名字已存在", JSON.toJSONString(baseRequest));
        }
        if (booktype.getParentid() != 0) {
            Booktype booktype1 = booktypeMapper.selectByPrimaryKey(booktype.getParentid());
            if (booktype1.getParentid() != 0) {
                throw new ServiceException(203020, "不能添加二级菜单为父菜单", JSON.toJSONString(baseRequest));
            }
        }

        booktype.setCreatedate(new Date());
        Sysuser sysuser = cacheManager.getSysUser(baseRequest.getUserId());
        booktype.setCreateuserid(sysuser.getUserid());
        booktype.setCreateusername(sysuser.getName());
        booktypeMapper.insertSelective(booktype);
        baseRespose.setReturnString(" ");

        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 删除书籍类型 deleteBookType
     **/
    public BaseRespose deleteBookType(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();
        Booktype booktype = null;
        try {
            booktype = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Booktype.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL);
        }
        if (ObjectUtils.isEmpty(booktype.getBooktypeid())) {
            throw new ServiceException(203020, "类型Id不能为空", JSON.toJSONString(baseRequest));
        }
        booktype = booktypeMapper.selectByPrimaryKey(booktype.getBooktypeid());
        if (ObjectUtils.isEmpty(booktype)) {
            throw new ServiceException(203020, "未找到该类型记录", JSON.toJSONString(baseRequest));
        }
        if (booktype.getBooktypename().equals("其他") && booktype.getParentid() == 0) {
            throw new ServiceException(203020, "不能删除默认的", JSON.toJSONString(baseRequest));
        }
        booktypeMapper.deleteByPrimaryKey(booktype.getBooktypeid());
        baseRespose.setReturnString(" ");

        return baseRespose;
    }
    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 选择书籍类型 chooseBookType
     **/
    public BaseRespose chooseBookType(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();
        Booktype booktype = null;
        try {
            booktype = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Booktype.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL, JSON.toJSONString(baseRequest));
        }
        if (ObjectUtils.isEmpty(booktype.getParentid())) {
            throw new ServiceException(203020, "请选择父类型", JSON.toJSONString(baseRequest));
        }
        BooktypeExample example = new BooktypeExample();
        example.createCriteria().andParentidEqualTo(booktype.getParentid());
        example.setOrderByClause("sort");
        baseRespose.setReturnString(booktypeMapper.selectByExample(example));
        return baseRespose;
    }


    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 查询书籍列表 selectBookList
     **/
    public BaseRespose selectBookList(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();
        BookPageVo bookPageVo = null;
        try {
            bookPageVo = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), BookPageVo.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL);
        }
        PageHelper.startPage(bookPageVo.getPagenum(), bookPageVo.getPagesize());
        List<Bookinformation> bookinformationList = bookinformationMapper.selectBookList(bookPageVo);
        PageInfo<Bookinformation> pageInfo = new PageInfo<>(bookinformationList);
        PageResposeVo pageResposeVo = new PageResposeVo(pageInfo.getTotal(), pageInfo.getList());
        baseRespose.setReturnString(pageResposeVo);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 查询书籍标签 selectBookLabel
     **/
    public BaseRespose selectBookLabel(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();
        Bookinformation bookinformation = null;
        try {
            bookinformation = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Bookinformation.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL);
        }
        List<BooklabelCustom> booklabelCustomList = booklabelMapper.selectBookLabel(bookinformation.getBookinformationid());

        baseRespose.setReturnString(booklabelCustomList);

        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 删除书籍标签 deleteBooklabel
     **/
    public BaseRespose deleteBooklabel(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();

        Booklabel booklabel = null;
        try {
            booklabel = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Booklabel.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL);
        }
        booklabelMapper.deleteByPrimaryKey(booklabel.getBooklabelid());
        baseRespose.setReturnString(" ");
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 修改书籍信息 updateBookInfo
     **/
    public BaseRespose updateBookInfo(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();

        Bookinformation bookinformation = null;
        try {
            bookinformation = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Bookinformation.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL);
        }
        if (ObjectUtils.isEmpty(bookinformation.getBookinformationid())) {
            throw new ServiceException(203020, "书籍Id不能为空", JSON.toJSONString(baseRequest));
        }
        Bookinformation bookinformation1=bookinformationMapper.selectByPrimaryKey(bookinformation.getBookinformationid());
        if(ObjectUtils.isEmpty(bookinformation1)){
            throw new ServiceException(203020, "未找到该书籍记录",JSON.toJSONString(baseRequest));
        }
        BookinformationExample example=new BookinformationExample();
        example.createCriteria().andAuthorEqualTo(bookinformation.getAuthor()).andBooknameEqualTo(bookinformation.getBookname()).andBookinformationidNotEqualTo(bookinformation1.getBookinformationid()).andDeletemarkEqualTo(0);
        List<Bookinformation> list=bookinformationMapper.selectByExample(example);
        if(list.size()>0){
            throw new ServiceException(203020, "书籍名和作者名已存在",JSON.toJSONString(baseRequest));
        }
        Sysuser sysuser = cacheManager.getSysUser(baseRequest.getUserId());
        bookinformation.setUpdatedate(new Date());
        bookinformation.setUpdateuserid(sysuser.getUserid());
        bookinformation.setUpdateusername(sysuser.getName());
        bookinformationMapper.updateBookInfo(bookinformation);
        baseRespose.setReturnString(" ");

        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 添加书籍 addBook
     **/
    public BaseRespose addBook(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();
        BookinformationCustom bookinformationCustom = null;
        try {
            bookinformationCustom = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), BookinformationCustom.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL, JSON.toJSONString(baseRequest));
        }
        if (ObjectUtils.isEmpty(bookinformationCustom.getBookname()) || ObjectUtils.isEmpty(bookinformationCustom.getAuthor())
                || ObjectUtils.isEmpty(bookinformationCustom.getIntroduction())
                || ObjectUtils.isEmpty(bookinformationCustom.getMainlevelid()) || ObjectUtils.isEmpty(bookinformationCustom.getMainlevelname())
                || ObjectUtils.isEmpty(bookinformationCustom.getSecondlevelid()) || ObjectUtils.isEmpty(bookinformationCustom.getSecondlevelname())
                ) {
            throw new ServiceException(ServiceCodeEnum.BAD_REQUEST, JSON.toJSONString(baseRequest));
        }
        BookinformationExample example = new BookinformationExample();
        example.createCriteria().andAuthorEqualTo(bookinformationCustom.getAuthor()).andBooknameEqualTo(bookinformationCustom.getBookname()).andDeletemarkEqualTo(0);
        List<Bookinformation> bookinformationList = bookinformationMapper.selectByExample(example);
        if (bookinformationList.size() > 0) {
            throw new ServiceException(203020, "该书籍已存在", JSON.toJSONString(baseRequest));
        }
        Sysuser sysuser = cacheManager.getSysUser(baseRequest.getUserId());
        bookinformationCustom.setCreateuserid(sysuser.getUserid());
        bookinformationCustom.setCreatedate(new Date());
        bookinformationCustom.setCreateusername(sysuser.getName());

        bookinformationMapper.insertGetId(bookinformationCustom);
        if (!ObjectUtils.isEmpty(bookinformationCustom.getLabelNames()) && bookinformationCustom.getLabelNames().size() > 0) {
            Integer labelid = null;
            List<Label> labelList = null;
            LabelExample labelExample = null;
            Booklabel booklabel = null;
            Label label = null;
            for (String labelName : bookinformationCustom.getLabelNames()
                    ) {
                labelExample = new LabelExample();
                labelExample.createCriteria().andBooktypeidEqualTo(bookinformationCustom.getMainlevelid()).andLabelnameEqualTo(labelName);
                labelList = labelMapper.selectByExample(labelExample);
                if (labelList.size() == 0) {
                    label = new Label();
                    label.setBooktypeid(bookinformationCustom.getMainlevelid());
                    label.setLabelname(labelName);
                    labelMapper.insertGetId(label);
                    labelid = label.getLabelid();
                } else {
                    labelid = labelList.get(0).getLabelid();
                    BooklabelExample booklabelExample1=new BooklabelExample();
                    booklabelExample1.createCriteria().andBookidEqualTo(bookinformationCustom.getBookinformationid()).andLabelidEqualTo(labelid);
                    List<Booklabel> booklabelList=booklabelMapper.selectByExample(booklabelExample1);
                    if(booklabelList.size()>0){
                        throw new ServiceException(203020, "该书籍已存在该书签",JSON.toJSONString(baseRequest));
                    }
                }
                booklabel = new Booklabel();
                booklabel.setLabelid(labelid);
                booklabel.setBookid(bookinformationCustom.getBookinformationid());
                booklabel.setLikesum(0);
                booklabel.setHatesum(0);
                booklabelMapper.insertSelective(booklabel);
            }
        }
        baseRespose.setReturnString(" ");

        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 删除书籍 deleteBook
     **/
    public BaseRespose deleteBook(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();

        Bookinformation bookinformation = null;
        try {
            bookinformation = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Bookinformation.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL);
        }
        if (ObjectUtils.isEmpty(bookinformation.getBookinformationid())) {
            throw new ServiceException(203020, "书籍Id不能为空", JSON.toJSONString(baseRequest));
        }
        Integer id = bookinformation.getBookinformationid();
        Sysuser sysuser = cacheManager.getSysUser(baseRequest.getUserId());
        bookinformation = new Bookinformation();
        bookinformation.setBookinformationid(id);
        bookinformation.setDeletedate(new Date());
        bookinformation.setDeletemark(1);
        bookinformation.setDeleteuserid(sysuser.getUserid());
        bookinformation.setDeleteusername(sysuser.getName());
        bookinformationMapper.updateByPrimaryKeySelective(bookinformation);
        baseRespose.setReturnString(" ");
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 添加书籍标签 addBookLabel
     **/
    public BaseRespose addBookLabel(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();
        Labelaudit labelaudit = null;
        try {
            labelaudit = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Labelaudit.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL);
        }
        if (ObjectUtils.isEmpty(labelaudit.getBookid()) || ObjectUtils.isEmpty(labelaudit.getLabelname())) {
            throw new ServiceException(203020, "请求信息不完整", JSON.toJSONString(baseRequest));
        }
        Bookinformation bookinformation = bookinformationMapper.selectByPrimaryKey(labelaudit.getBookid());
        if (ObjectUtils.isEmpty(bookinformation)) {
            throw new ServiceException(203020, "未找到该书籍", JSON.toJSONString(baseRequest));
        }
        BooklabelExample booklabelExample = new BooklabelExample();
        booklabelExample.createCriteria().andBookidEqualTo(labelaudit.getBookid());
        int count = booklabelMapper.countByExample(booklabelExample);
        if (count >= Constants.BOOK_SUM_LABEL) {
            throw new ServiceException(203020, "该书籍的标签已满", JSON.toJSONString(baseRequest));
        }

        LabelExample labelExample = new LabelExample();
        labelExample.createCriteria().andBooktypeidEqualTo(bookinformation.getMainlevelid()).andLabelnameEqualTo(labelaudit.getLabelname());
        List<Label> labelList = labelMapper.selectByExample(labelExample);
        Integer labelid = 0;
        if (labelList.size() == 0) {
            Label label = new Label();
            label.setBooktypeid(bookinformation.getMainlevelid());
            label.setLabelname(labelaudit.getLabelname());

            labelMapper.insertGetId(label);
            labelid = label.getLabelid();
        } else {
            labelid = labelList.get(0).getLabelid();
            BooklabelExample booklabelExample1=new BooklabelExample();
            booklabelExample1.createCriteria().andBookidEqualTo(bookinformation.getBookinformationid()).andLabelidEqualTo(labelid);
            List<Booklabel> booklabelList=booklabelMapper.selectByExample(booklabelExample1);
            if(booklabelList.size()>0){
                throw new ServiceException(203020, "该书籍已存在该书签",JSON.toJSONString(baseRequest));
            }
        }


        Booklabel booklabel = new Booklabel();
        booklabel.setLabelid(labelid);
        booklabel.setBookid(bookinformation.getBookinformationid());
        booklabel.setLikesum(0);
        booklabel.setHatesum(0);
        booklabelMapper.insertSelective(booklabel);
        baseRespose.setReturnString(" ");

        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 书籍审核列表 selectBookAuditList
     **/
    public BaseRespose selectBookAuditList(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();


        BookPageVo bookPageVo = null;
        try {
            bookPageVo = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), BookPageVo.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL);
        }
        PageHelper.startPage(bookPageVo.getPagenum(), bookPageVo.getPagesize());
        PageHelper.orderBy("createDate desc");
        List<Bookaudit> bookauditList = bookauditMapper.selectBookAuditList(bookPageVo);
        PageInfo<Bookaudit> pageInfo = new PageInfo<>(bookauditList);
        PageResposeVo pageResposeVo = new PageResposeVo(pageInfo.getTotal(), pageInfo.getList());
        baseRespose.setReturnString(pageResposeVo);

        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 书籍审核 不通过 bookAuditNoPass
     **/
    public BaseRespose bookAuditNoPass(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();

        Bookaudit bookaudit = null;
        try {
            bookaudit = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Bookaudit.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL);
        }
        if (ObjectUtils.isEmpty(bookaudit.getBookinauditid()) || ObjectUtils.isEmpty(bookaudit.getNopasstxt())) {
            throw new ServiceException(203020, "请求信息不完整", JSON.toJSONString(baseRequest));
        }
        Bookaudit bookaudit1 = bookauditMapper.selectByPrimaryKey(bookaudit.getBookinauditid());
        if (ObjectUtils.isEmpty(bookaudit1)) {
            throw new ServiceException(203020, "未找到该记录", JSON.toJSONString(baseRequest));
        }
        if (bookaudit1.getStatus() != 0) {
            throw new ServiceException(203020, "只能审核 审核中的记录", JSON.toJSONString(baseRequest));
        }
        Sysuser sysuser = cacheManager.getSysUser(baseRequest.getUserId());
        bookaudit.setStatus(2);
        bookaudit.setAuditdate(new Date());
        bookaudit.setAudituserid(sysuser.getUserid());
        bookaudit.setAuditusername(sysuser.getName());
        bookauditMapper.updateByPrimaryKeySelective(bookaudit);
        baseRespose.setReturnString(" ");

        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 书籍审核 通过 bookAuditPass
     **/
    public BaseRespose bookAuditPass(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();

        Bookaudit bookaudit = null;
        try {
            bookaudit = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Bookaudit.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL);
        }
        if (ObjectUtils.isEmpty(bookaudit.getBookinauditid())) {
            throw new ServiceException(203020, "请求信息不完整", JSON.toJSONString(baseRequest));
        }
        Bookaudit bookaudit1 = bookauditMapper.selectByPrimaryKey(bookaudit.getBookinauditid());
        if (ObjectUtils.isEmpty(bookaudit1)) {
            throw new ServiceException(203020, "未找到该记录", JSON.toJSONString(baseRequest));
        }
        if (bookaudit1.getStatus() != 0) {
            throw new ServiceException(203020, "只能审核 审核中的记录", JSON.toJSONString(baseRequest));
        }
        Sysuser sysuser = cacheManager.getSysUser(baseRequest.getUserId());
        bookaudit.setStatus(1);
        bookaudit.setAuditdate(new Date());
        bookaudit.setAudituserid(sysuser.getUserid());
        bookaudit.setAuditusername(sysuser.getName());
        bookauditMapper.updateByPrimaryKeySelective(bookaudit);

        baseRespose.setReturnString(" ");

        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 删除书籍审核记录 deleteBookAudit
     **/
    public BaseRespose deleteBookAudit(BaseRequest baseRequest) {
        BaseRespose baseRespose = new BaseRespose();

        Bookaudit bookaudit = null;
        try {
            bookaudit = JSON.parseObject(JSON.toJSONString(baseRequest.getRequestString()), Bookaudit.class);
        } catch (Exception e) {
            throw new ServiceException(ServiceCodeEnum.INFO_IS_FAIL);
        }
        if (ObjectUtils.isEmpty(bookaudit.getBookinauditid())) {
            throw new ServiceException(203020, "请求信息不完整", JSON.toJSONString(baseRequest));
        }
        Sysuser sysuser = cacheManager.getSysUser(baseRequest.getUserId());
        bookaudit.setDeletemark(11);
        bookaudit.setDeletedate(new Date());
        bookaudit.setDeleteuserid(sysuser.getUserid());
        bookaudit.setDeleteusername(sysuser.getName());
        bookauditMapper.updateByPrimaryKeySelective(bookaudit);
        baseRespose.setReturnString(" ");
        return baseRespose;
    }


}
